package com.kun.portal.webframe.controller;

import com.kun.portal.webframe.po.FlightInfoPo;
import com.kun.portal.webframe.po.RoomPo;
import com.kun.portal.webframe.service.FlightInfoService;
import com.kun.portal.webframe.service.RoomService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpSession;

import java.util.List;

/**
 * Created by Administrator on 2018/5/8.
 */
@Controller
//
@RequestMapping({"/api/flightInfo"})
public class FlightInfoController  {
    private static final Logger LOG = LoggerFactory.getLogger(FwUserController.class);
    @Autowired
    private FlightInfoService flightInfoService;
    @RequestMapping(
            value = {"/query"},
            method = {RequestMethod.GET},
            produces = {"application/json"}
    )
    @ResponseBody
    public Page<FlightInfoPo> query(@RequestParam String filter, Pageable pageable, HttpSession session) {
        return flightInfoService.query(filter,pageable);
    }

    @RequestMapping(
            value = {"/queryFlightInfo"},
            method = {RequestMethod.GET},
            produces = {"application/json"}
    )
    @ResponseBody
    public List<FlightInfoPo> queryFlightInfo(@RequestParam(required = false) String filter, HttpSession session) {
        return flightInfoService.queryFlightInfo(filter);
    }


    @RequestMapping(
            value = {"/saveFlightInfo"},
            method = {RequestMethod.POST},
            produces = {"application/json"}
    )
    @ResponseBody
    public FlightInfoPo saveFlightInfo(@RequestBody  FlightInfoPo flightInfoPo, HttpSession session) {
        return flightInfoService.saveFlightInfo(flightInfoPo);
    }
    @RequestMapping(
            value = {"/deleteFlightInfo"},
            method = {RequestMethod.POST},
            produces = {"application/json"}
    )
    @ResponseBody
    public void deleteFlightInfo(@RequestBody  FlightInfoPo flightInfoPo, HttpSession session) {
         flightInfoService.delete(flightInfoPo);
    }




}
